package cn.itsource.controller;

import cn.itsource.utils.AjaxResult;
import cn.itsource.utils.RedisUtils;
import org.springframework.web.bind.annotation.*;

import java.awt.image.Kernel;

@RestController
@RequestMapping("/redis")
public class RedisController {

    @PostMapping("/set")
    public AjaxResult set(@RequestParam("key") String key , @RequestParam("value") String value){
        RedisUtils.INSTANCE.set(key,value);
        return AjaxResult.me();
    }

    @GetMapping("/get/{key}")
    public AjaxResult get(@RequestParam("key") String key){
        String result = RedisUtils.INSTANCE.get(key);
        return AjaxResult.me().setResultObj(result);
    }
}
